// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'

import 'element-ui/lib/theme-chalk/index.css'
import element from './elementUi/index'
Vue.use(element)

import VueQuillEditor  from 'vue-quill-editor'
// import ImageResize from 'quill-image-resize-module'
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'
 
Vue.use(VueQuillEditor)
// Vue.use(ImageResize)

Vue.config.productionTip = false

router.beforeEach((to, from, next) => {
  if (to.path == "/login") {
    next()
  } else if (to.path == "/regist") {
    next()
  } else if (to.path == "/forget") {
    next()
  } else if (!sessionStorage.getItem("token")) { // token存在条件   
    next({
      path: '/login' // 验证失败要跳转的页面
    })
  } else {
    next()
  }
})

/* eslint-disable no-new */
window.vm = new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})
